<?php

namespace myshop\common\dao;

use longhu\base\BaseDao;
use longhu\base\BaseModel;
use myshop\students\model\Students;
use myshop\system\model\Organs;

class StudentsDao extends BaseDao
{
    public static $studentFields = 'id,organ_id,students_no,username,mobile,student_name,sex,head_img,card_type
    ,card_id,birthday,job_type,job,post_type,post,positions,subject,education,degree,work_time,graduated,nation
    ,native_place,address,countenance,transfer_status,status';

    public static $organFields = '';
    public function setModel():string
    {
        return Students::class;
    }


    /**
     * @param array $where
     * @param array $with
     * @return BaseModel
     */
    public function search(array $where,array $with = []):BaseModel
    {
        return $this->getModel()->catchSearch($where)
            ->catchJoin(Organs::class)
            ->field(self::$studentFields);

    }

    public function pageLists(array $where)
    {
        return $this->search($where)->catchOrder()->paginate();
    }
}